A texture used for rendering, hosted on GPU. More...
Public Member Functions | |
Texture () | |
virtual | ~Texture () |
virtual void | setResourcePath (const std::string_view &path) override |
ResourceCpuDataDescriptor * | getCpuData () const |
bool | isFromFile () const |
bool | isGammaCorrected () const |
bool | isBackBufferTex () const |
TEX_TYPE | getTexType () const |
TEX_RENDER_FLAG | getRenderFlag () const |
unsigned int | getNeededMipsForSize () const |
virtual int | getWidth () const =0 |
virtual int | getHeight () const =0 |
virtual int | getDepthOrArraySize () const =0 |
virtual unsigned int | getMipLevels () const =0 |
virtual FORMAT | getTextureFormat () const =0 |
virtual CPU_ACCESS_FLAG | getCpuAccessRights () const =0 |
virtual USAGE | getTextureUsage () const =0 |
virtual BIND_FLAG | getTextureBinding () const =0 |
virtual RESOURCE_MISC_FLAG | getMiscFlag () const =0 |
virtual unsigned int | getSampleCount () const =0 |
virtual unsigned int | getSampleQuality () const =0 |
virtual bool | getAutoMipGeneration () const =0 |
void | setCpuData (const ResourceCpuDataDescriptor &data) |
void | setBackBufferTex (bool value) |
virtual void | freeCpuData (bool freeDataPtr) |
virtual void | setGammaCorrected (bool value) |
virtual void | setWidth (unsigned int width)=0 |
virtual void | setHeight (unsigned int height)=0 |
virtual void | setDepth (unsigned int depth)=0 |
virtual void | setArraySize (unsigned int size)=0 |
virtual void | setMipLevels (unsigned int value)=0 |
virtual void | setTextureFormat (FORMAT format)=0 |
virtual void | setCpuAccessRights (CPU_ACCESS_FLAG rights)=0 |
virtual void | setTextureUsage (USAGE usage)=0 |
virtual void | setTextureBinding (BIND_FLAG binding)=0 |
virtual void | setAutoMipGeneration (bool value)=0 |
virtual void | copyParams (const Texture &other)=0 |
void | setTextureFormatFromString (const std::string_view &str) |
virtual void | prepareAsTexture2d () |
virtual void | prepareAsCubemap () |
virtual void | prepareAsTexture3d () |
virtual void | setRenderFlag (TEX_RENDER_FLAG value) |
virtual bool | preLoadFromFile ()=0 |
virtual MapResult | map (const MapRequestDescriptor &requestDesc)=0 |
virtual void | unmap (const UnmapRequestDescriptor &requestDesc)=0 |
virtual void | gpuCopyFrom (Texture &other, const ResourceGpuCopyDescriptor &descriptor)=0 |
virtual void | exportClassToTree (nkExport::Node *rootNode) override |
virtual void | importClassFromTree (nkExport::Node *rootNode) override |
![]() | |
ShaderResource () | |
~ShaderResource () | |
virtual void | activate (SHADER_TYPE shaderStage, unsigned int slot)=0 |
![]() | |
Resource () | |
Resource (const char *path) | |
virtual | ~Resource () |
virtual bool | load ()=0 |
virtual void | unload ()=0 |
bool | isReadyForRendering () const |
bool | isUnloaded () const |
RESOURCE_LOAD_STATE | getLoadState () const |
std::string_view | getResourcePath () const |
RESOURCE_TYPE | getResourceTypeName () const |
std::string_view | getResourceName () const |
bool | getHidden () const |
void | setResourceName (const std::string_view &name) |
void | setHidden (bool value) |
![]() | |
Exportable () | |
virtual | ~Exportable () |
A texture used for rendering, hosted on GPU.
nkGraphics::Texture::Texture | ( | ) |
Constructor.
|
virtual |
Destructor.
|
overridevirtual |
See Resource::setResourcePath().
Reimplemented from nkGraphics::Resource.
ResourceCpuDataDescriptor* nkGraphics::Texture::getCpuData | ( | ) | const |
bool nkGraphics::Texture::isFromFile | ( | ) | const |
bool nkGraphics::Texture::isGammaCorrected | ( | ) | const |
bool nkGraphics::Texture::isBackBufferTex | ( | ) | const |
TEX_TYPE nkGraphics::Texture::getTexType | ( | ) | const |
TEX_RENDER_FLAG nkGraphics::Texture::getRenderFlag | ( | ) | const |
unsigned int nkGraphics::Texture::getNeededMipsForSize | ( | ) | const |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
void nkGraphics::Texture::setCpuData | ( | const ResourceCpuDataDescriptor & | data | ) |
data | The texture data to feed from the cpu to the texture. |
void nkGraphics::Texture::setBackBufferTex | ( | bool | value | ) |
value | If the texture is the back buffer, aka the final texture, of a RenderContext. |
|
virtual |
Frees the cpu data attached to the texture, possibly also freeing the memory given. This function has to be called after the load method has been called, for the process to know when the data can be fred.
freeDataPtr | If the data pointer provided should be freed also. |
|
virtual |
value | If the texture should be gamma corrected (true) or not (false). |
|
pure virtual |
width | The width of the texture, in pixels. |
|
pure virtual |
height | The height of the texture, in pixels. |
|
pure virtual |
depth | The depth of the texture, in pixels. |
|
pure virtual |
size | The array size of the texture, in number of slices. |
|
pure virtual |
value | The number of mips wanted for the texture. Can be 0 to mean that all mips should be used. |
|
pure virtual |
format | The format to assign to the texture. |
|
pure virtual |
rights | The cpu access flag wanted. |
|
pure virtual |
usage | The texture usage. |
|
pure virtual |
binding | The binding flag to use. Can be or'ed. |
|
pure virtual |
value | If the missing mips should automatically be generated upon load (true) or not (false). |
|
pure virtual |
Copies the decription parameters (width, height, format...) from another texture.
other | The texture to copy the information from. |
void nkGraphics::Texture::setTextureFormatFromString | ( | const std::string_view & | str | ) |
str | The string defining the format to use. StructToString will be used for translation. |
|
virtual |
Prepares the texture as a 2d texture. Should be used to change the internal texture type, impacting the way the texture will be loaded.
|
virtual |
Prepares the texture as a cubemap. Should be used to change the internal texture type, impacting the way the texture will be loaded.
|
virtual |
Prepares the texture as a 3d texture. Should be used to change the internal texture type, impacting the way the texture will be loaded.
|
virtual |
Allows to change the render flag of the texture. It needs to be called for texture that will need to be used as targets.
value | The flag to set. |
|
pure virtual |
If the texture comes from an external file, this function can be called to load the file into memory before using the texture. This function is isolated enough that it can be called off-thread (be sure not to change the texture in main thread during this process).
|
pure virtual |
Maps the texture memory for CPU interaction. Be sure to select the smallest map type needed, as a map operation can cause a flush in the rendering pipeline.
requestDesc | The map request description. |
|
pure virtual |
Unmap the texture memory. This needs to be called the earliest possible after a map operation. This operation will potentially commit the changes made in mapped data, to the GPU.
requestDesc | The unmap request. |
|
pure virtual |
Copies memory from another texture, in the GPU context.
other | The texture to copy the data from. |
descriptor | The description of the data to copy. |
|
overridevirtual |
Basic exporting capabilities.
rootNode | The tree to export to. |
Implements nkExport::Exportable.
|
overridevirtual |
Basic importing capabilities.
rootNode | The tree to import from. |
Implements nkExport::Exportable.